<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        *{
            margin: 0;
            padding: 0;

        }
        #app{
            width: 100%;
            height:700px ;
            border: 1px solid #ccc;
        }
        .title{
            width: 100%;
            height: 50px;
            /* background-color: aqua; */
            display: flex;
            line-height: 60px;
            
        }
        .title input{
            height: 20px;
            width: 40px;
            border-radius: 16px;
            padding: 10px;
            margin-left: 10px;
            margin-top: 3px;
        }
        .title .one{
            /* background-color: aquamarine; */
            margin-left: 20px;
            color: blue;
            border-bottom: 5px solid blue;
        }
        .title .two{
            margin-left: 20px;
        }
        .left{
            width: 34%;
            height: 500px;
            /* background-color: blueviolet; */
        }
        .left ul li{
            margin: 30px;
        }
        ul li{
            list-style: none;
        }
        .right{
            width: 66%;
            height: 500px;
        }
        .list{
            width: 100%;
            height: 120px;
            margin-top: 10px;
            /* display: flex; */
            /* background-color: chartreuse; */
        }
        .body{
            display: flex;
        }
        .name{
            font-size: 15px;
            font-weight: 700; 
        }
        .name3, .name2{
            font-size: 12px;
        }
        .num{
            display: flex;
            justify-content: space-between;
        }
        .num, .num1{
            color: red;
        }
        .num, button{
            border-radius: 50%;
            margin-right: 10px; 
        }
        .bottom{
            display: flex;
            justify-content: space-around;
            background-color: #ccc;
            width: 100%;
            height: 50px;
            line-height: 50px;
        }
        .bottom button{
            width: 100px;
            height: 40px;
            border-radius: 5px;
            background-color: green;
            color: white;
            margin: 5px;
        }
        img{
            width: 100px;
            height: 90px;
            float: left;
            /* margin-top: 20px; */
        }
        .left li.active{
            color: red;
            font-weight: bold
        }
    </style>
</head>
<body>
    <div id="app">
        <div class="title">
            <input type="text" placeholder="搜索">
            <div class="one">点赞</div>
            <div class="two">评价4.5</div>
            <div class="two">商家</div>
        </div>
        <div class="body">
            <div class="left">
                <ul>
                    <!-- <li>热销</li>
                    <li>优惠</li>
                    <li>三文鱼</li>
                    <li>刺身</li>
                    <li>年货礼品区</li>
                    <li>野生大对虾</li>
                    <li>冻货区</li>
                    <li>贝壳蜗类</li>
                    <li>鲜虾活鱼</li> -->
                    <li @click="handleClick(index)"v-for="(item,index) in tablist" :key="index" :class="{
                        active:currentIndex==index}">{{item.text}}</li>
                </ul>
            </div>
            <div class="right">
                <div class="list" v-for="(item,index) in tasklist" :key="index">
                    <img :src="item.pic" alt="">
                    <div class="name">{{item.name}}</div>
                    <div class="name2">{{item.name2}}</div>
                    
                    <div class="name3">{{item.name3}}</div>
                    <div class="num">
                        <span class="num1">￥{{item.num1}}</span>
                        <div class="num2">{{item.num2}}</div>
                        <button class="jia" @click="jia1(item)"> + </button>
                    </div>
                </div>
            </div>
        </div>
        <div class="bottom">
            <div class="all">总价 <span v-text="all()"></span> 元</div>
            <button>去结算</button>
        </div>
    </div>
</body>
<script src="./vue-2.5.21.js"></script>
<script>
    var v=new Vue({
        el:'#app',
        data:{
            tasklist:[
                {id:1,pic:'./ing/06.webp',name:'挪威三文鱼刺身薄片',name2:'取于三文鱼中段，口感鲜甜，富含....',name3:'月售40份 好评率100%',num1:'45',num2:1},
                {id:2,pic:'./ing/05.webp',name:'挪威三文鱼刺身薄片',name2:'取于三文鱼中段，口感鲜甜，富含....',name3:'月售40份 好评率100%',num1:'8',num2:1},
                {id:3,pic:'./ing/04.webp',name:'挪威三文鱼刺身薄片',name2:'取于三文鱼中段，口感鲜甜，富含....',name3:'月售40份 好评率100%',num1:'54.4',num2:1},
                {id:4,pic:'./ing/03.webp',name:'挪威三文鱼刺身薄片',name2:'取于三文鱼中段，口感鲜甜，富含....',name3:'月售40份 好评率100%',num1:'28',num2:1}
            ],
            currentIndex:0,
            tablist:[
                {text:'优惠'},
                {text:'三文鱼'},
                {text:'刺身'},
                {text:'年货礼品区'},
                {text:'野生大对虾'},
                {text:'冻货区'},
                {text:'贝壳蜗类'},
                {text:'鲜虾活鱼'},
            ]
        },
        methods:{
            handleClick(index){
                this.currentIndex=index
            },
            jia1(item){
                item.num2++
                // console.log(num2);
            },
            all(item){
                var alla=0
                this.tasklist.forEach((item,index)=>{

                    alla+=item.num1*item.num2
                    // console.log(alla);
                })
                return alla
            },
            
            
        }
    })
</script>
</html>